<?php

 /**
  * @package JooS
  * @subpackage Syntax
  */

  require_once "JooS/Syntax/Complex/Transition.php";

 /**
  * String ::= "'" , { "\'" | Any - "'" } , "'" | '"' , { '\"' | Any - '"' } , '"';
  **/
  class JooS_Syntax_Common_String extends JooS_Syntax_Complex_Transition {
    /**
     * @return JooS_Syntax_Complex_Choose
     */
    public function createRule() {
      $parser = $this->getParser();
      
      return $parser->createSyntax("Complex_Choose", array(
        $parser->createSyntax("Complex_Concatenate", array(
          $parser->createSyntax("Simple_Symbol", "'"),
          $parser->createSyntax("Complex_Repetition", $parser->createSyntax("Complex_Choose", array(
            $parser->createSyntax("Simple_Symbol", "\\'"),
            $parser->createSyntax("Except", $parser->createSyntax("Simple_Any"), $parser->createSyntax("Simple_Symbol", "'"))
          ))), 
          $parser->createSyntax("Simple_Symbol", "'")
        )), 
        $parser->createSyntax("Complex_Concatenate", array(
          $parser->createSyntax("Simple_Symbol", "\""),
          $parser->createSyntax("Complex_Repetition", $parser->createSyntax("Complex_Choose", array(
            $parser->createSyntax("Simple_Symbol", "\\\""),
            $parser->createSyntax("Except", $parser->createSyntax("Simple_Any"), $parser->createSyntax("Simple_Symbol", "\""))
          ))), 
          $parser->createSyntax("Simple_Symbol", "\""),
        ))
      ));
    }
  }
